using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Text;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Linq;

namespace ClubWebsite
{
    public partial class ClubsList : System.Web.UI.UserControl
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // Display the list of clubs
            StringBuilder list = new StringBuilder();
            var clubs = Functions.GetDatabaseDataContext()
                .DBClubs
                .Where(c => c.ID != Guid.Empty)
                .OrderBy(c => c.Name)
                .Select(c => new { c.ID, c.Name });
            foreach (var club in clubs)
            {
                list.AppendLine(String.Format("[Club={0}]{1}[/Club]<br />", club.ID, club.Name));
            }
            litList.Text = Functions.ConvertTextWithTagsIntoHTML(list.ToString(), Page.Master);
        }
    }
}